<?php
defined('JOC') or die;

/**
 * Description of article
 * 
 * @author jcamelis
 * 
 * Depends : 
 *    core/module/module.class.php
 *    core/module/form.class.php
 *    core/db/db.php
 */
class media extends Module
{
  public  $id ;
  public  $permanent_link = '' ;
  public  $arrIds    = Array() ;
  public  $_elements = Array() ;

  //Database table constants
  protected $_table_name  = 'joc_cms_media' ;
  protected $_pk_name     = 'media_id' ;
  
  function __construct()
  {
    parent::__construct();
    //Some stuff here;
  }
/*
 * here begins the CRUD method 
*/
  function crud( $method = 'read',$sub_method = 'simple' )
  {
    $_to_be_call = "_{$$method}_{$sub_method}";
    return method_exists(__CLASS__,$_to_be_call) ? $this->$_to_be_call() : false ;
  }
/* CREATE */
  function _create_simple()
  {
    
  }
  function _create_multiple()
  {
    
  }
/* READ */
  function _read_simple()
  {
    global $db ;
    $arrURI = R::get('uri') ?  R::server('uri') : Array() ;
    if($arrURI[1] && $this->permanent_link = seo::escape( $arrURI[1] ) ){
      $sql = " SELECT * FROM {prefix}media WHERE permanent_link = MD5({$this->permanent_link}) LIMIT 1 ; " ;
      
    }
  }
  function _read_multiple()
  {
    
  }

/* UPDATE */
  function _update_simple()
  {
    
  }
  function _update_multiple()
  {
    
  }
/* DELETE */
  function _delete_simple()
  {
    
  }
  function _delete_multiple()
  {
    
  }
}
